package com.liuxvru.project.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liuxvru.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.liuxvru.project.mapper.FlawMapper;
import com.liuxvru.project.domain.Flaw;
import com.liuxvru.project.service.IFlawService;

/**
 * 缺陷Service业务层处理
 * 
 * @author liuxvru
 * @date 2025-03-21
 */
@Service
public class FlawServiceImpl extends ServiceImpl<FlawMapper, Flaw> implements IFlawService
{
    /**
     * 查询缺陷列表
     * 
     * @param flaw 缺陷
     * @return 缺陷
     */
    @Override
    public List<Flaw> selectFlawList(Flaw flaw)
    {
        return baseMapper.selectFlawList(flaw);
    }

    @Override
    public int add(Flaw flaw) {
        Long userId = SecurityUtils.getUserId();
        flaw.setCreatedBy(userId);
        flaw.setUpdatedBy(userId);
        return baseMapper.insert(flaw);
    }
}
